/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package phan.connection;

import java.io.*;
import javax.jms.Session;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class for Servlet: LoginServlet
 *
 */
public class ActionObjet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    /* (non-Java-doc)
     * @see javax.servlet.http.HttpServlet#HttpServlet()
     */

    public ActionObjet() {
        super();
    }

    /* (non-Java-doc)
     * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

    /* (non-Java-doc)
     * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      //  String deleteObject = request.getParameter("deleteObject");
        System.out.println("vao servlet delete element");
String[] deleterecord=null;
String delStr="";
deleterecord=request.getParameterValues("chkid");
Boolean valide = false;
if(deleterecord!=null){
    MySQLDBConnector connector =new MySQLDBConnector();
  valide=  connector.deleteElement(deleterecord);
}
System.out.println("Select values are : " + delStr);


		//String password = request.getParameter("pass").toString();




		if(valide){
            request.setAttribute ("isValide", "yes");
		    RequestDispatcher disp ;
		    disp=request.getRequestDispatcher("/PageCL_ABN.jsp");
		    disp.include(request,response);


        }

        else{
        	request.setAttribute ("isValide", "no");
		    RequestDispatcher disp ;
		    disp=request.getRequestDispatcher("/retry.jsp");
		    disp.include(request,response);
        }
    }
}